<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{lang(OnlinePayment)}</title>
<meta name="keywords" content="{if $archive[keyword]}{$archive[keyword]}{else}{if $type[keyword]}{$type[keyword]}{elseif $category[$catid][keyword]}{$category[$catid][keyword]}{else}{get('site_keyword')}{/if}{/if}" />
<meta name="description" content="{if $archive[description]}{$archive[description]}{else}{if $type[description]}{$type[description]}{elseif $category[$catid][description]}{$category[$catid][description]}{else}{get('site_description')}{/if}{/if}" />
<meta name="author" content="CmsEasy Team" />
<link rel="icon" href="{$base_url}/favicon.ico" type="image/x-icon" />

<style type="text/css">
body {font-size:12px;}
td.td_left,td.td_right {padding:3px 15px;}
td.td_left {text-align:right;}
.back {
  display:block;
  width:72px;
  height:21px;
  line-height:20px;
  padding-left:10px;
  background:url({$skin_path}/images/back.gif) left top no-repeat;
  text-align:center;
  color:white;
  font-size:12px;
  text-decoration: none;
  border:none;
}
.title h1 {
  line-height:40px;
  padding-top:20px;
  font-size:22px;
  text-align:center;
  background:url({$skin_path}/images/point.gif) left bottom repeat-x;
  color:#333;
  font-weight:normal;
  font-family:'微软雅黑';
}
.back a,.back a:hover {text-decoration: none;color:white;}
.f a {color:#ccc;text-decoration: none;}

.blank30 {clear:both;height:30px;}
.blank10 {clear:both;height:10px;}
.box {clear:both; width:699px;margin:0px auto;padding:0px auto;overflow:hidden;}
.c_top {
  clear:both;
  height:10px;
  background:url({$skin_path}/images/c_top.gif) -280px top no-repeat;
}

.c_bg {
  background:url({$skin_path}/images/c_bg.gif) left top repeat-y;
}

.c_bottom {
  clear:both;
  height:10px;
  background:url({$skin_path}/images/c_bottom.gif) left top no-repeat;
}

textarea {margin:5px 0px;}

</style>
</head>
<body>

<!-- 中部开始 -->
<div class="clear box c_bg">
<div class="c_top"></div>
<div style="padding:0px 20px;">
<!-- 内容标题 -->
<div class="title"><h1>{lang(OnlinePayment)}</h1></div>
<div id="content" class="clear">


<script type="text/javascript">
window.onload = function(){
	document.getElementById('totalorders').innerHTML = document.getElementById('pnums').value*document.getElementById('pprice').innerText;
}
function changetotalprdersprice(){
	var num = document.getElementById('pnums').value;
	var numarr = num.match(/^[0-9]+$/);
	if(num<1){
		alert('{lang(orderquantity)}');
		document.getElementById(numid).value=1;
	}else if(numarr==null){
		alert('{lang(orderquantity)}');
		document.getElementById(numid).value=1;
	}
	document.getElementById('totalorders').innerHTML = document.getElementById('pnums').value*document.getElementById('pprice').innerText;
}
function changetotalprdersprice1(id,priceid,numid){
	var num = document.getElementById(numid).value;
	var numarr = num.match(/^[0-9]+$/);
	if(num<1 && num!=0){
		alert('{lang(orderquantity)}');
		document.getElementById(numid).value=1;
	}else if(numarr==null && num!=0){
		alert('{lang(orderquantity)}');
		document.getElementById(numid).value=1;
	}
	document.getElementById(id).innerHTML = document.getElementById(numid).value*document.getElementById(priceid).innerText;
	gettotalprice();
}
function gettotalprice(){
	var listt = 0;
	<?php
	if(isset($orderaidlist)){
	foreach($orderaidlist as $val){
		?>		
		listt = parseInt(document.getElementById('thistotal<?php echo $val[aid];?>').innerHTML)+listt;
		document.getElementById('listtotal').value = listt;
		//alert(listt);
	<?php
	}
	}
	?>
	document.getElementById('listtotalhidden').value = document.getElementById('listtotal').value;
}
</script>

<script type="text/javascript">

function check()
            {
	
if(document.orders.pnums.value.length==0){
   alert("{lang(enter)}{lang(ordercontactname)}!");
   document.orders.pnums.focus();
   return false;
}

if(document.orders.pname.value.length==0){
   alert("{lang(enter)}{lang(ordercontactname)}!");
   document.orders.pname.focus();
   return false;
}

if(document.orders.telphone.value.length==0){
   alert("{lang(enter)}{lang(ordertel)}!");
   document.orders.telphone.focus();
   return false;
}

if(document.orders.address.value.length==0){
   alert("{lang(enter)}{lang(orderaddress)}!");
   document.orders.address.focus();
   return false;
}

if(document.orders.postcode.value.length==0){
   alert("{lang(enter)}{lang(postcode)}!");
   document.orders.postcode.focus();
   return false;
}


if(document.orders.pnums.value.length==0){
   alert("{lang(enter)}{lang(ordercontactname)}!");
   document.orders.pnums.focus();
   return false;
}

return true; 
} 
</script>

<form action="{uri()}" id="orders" name="orders" method="post" onclick="gettotalprice();" onsubmit="return check()">
<table width="100%" border="1" align="center" cellpadding="8" cellspacing="0" bordercolor="#CCCCCC" style="border-collapse:collapse;" bgcolor="#F9F9F9">
    {if $orderaidlist}
   <tr>
    <td colspan="2">
    
       <table width="100%" border="1" align="center" cellpadding="8" cellspacing="0" bordercolor="#CCCCCC" style="border-collapse:collapse;" bgcolor="#F9F9F9">
        <tr class="th">
          <th>{lang(productname)}</th>
          <th>{lang(productprice)}</th>
          <th>{lang(pordernums)}</th>
          <th>{lang(subtotal)}</th>
          <th></th>
        </tr>
        {loop $orderaidlist $val}
        <input type="hidden" name="aid[]" value="{$val['aid']}" />
        <tr id="list{$val['aid']}">
          <td align="center">{$val[title]}</td>
          <td id="thisprice{$val[aid]}" align="center">{$val[attr2]}</td>
          <td align="center"><input type="text" style="text-align:center;" id="thisnum{$val[aid]}" name="thisnum[{$val[aid]}]" value="{$val[amount]}" size="5"  onchange="changetotalprdersprice1('thistotal{$val[aid]}','thisprice{$val[aid]}','thisnum{$val[aid]}')" /></td>
          <td id="thistotal{$val[aid]}" align="center"><?php echo $val[attr2]*$val[amount];?></td>
          <td align="center"><input type="button" name="" value=" {lang(delete)} " onclick="document.getElementById('list{$val['aid']}').style.display='none';document.getElementById('thisnum{$val[aid]}').value=0;changetotalprdersprice1('thistotal{$val[aid]}','thisprice{$val[aid]}','thisnum{$val[aid]}');gettotalprice();" /></td>
        </tr>
        {/loop}
      </table>

</td>
</tr>

    {else}
      <tr> 
        <td width="30%" align="right">{lang(productname)}：</td> 
        <td width="70%" align="left">{$archive[title]}</td> 
      </tr> 
      <tr> 
        <td align="right">{lang(productprice)}：</td> 
        <td align="left"><span id="pprice">{$archive[attr2]}</span> {lang(unit)}</td> 
      </tr> 
      
     {/if}
      <tr> 
        <td align="right"> </td> 
        <td align="left"> </td> 
      </tr>     
       
     {if !$orderaidlist}
      <tr> 
        <td align="right">{lang(pordernums)}：</td> 
        <td align="left"><input type="text" size="10" maxlength="10" name="pnums" id="pnums" value="1" onchange="changetotalprdersprice()" /> <font color="green">{lang(canfill)}</font>
          </td> 
      </tr>
       <tr>
        <td style="width:160px;" align="right">{lang(ordertotal)}：</td> 
        <td id="totalorders" align="left"></td> 
      </tr>
      {else}
      <tr> 
        <td style="width:160px;"  align="right">{lang(ordertotal)}：</td> 
        <td align="left"><input id="listtotal" type="text" name="listtotal" value="" size="10" disabled="disabled" />
        <input type="hidden" name="listtotalhidden" value="" size="10" />
        </td> 
      </tr> 
      {/if} 
      
      
      <tr> 
        <td align="right">{lang(ordercontactname)}：</td> 
        <td align="left"><input type="text" size="20" name="pname" /> 
          <font color="green">{lang(pcontactnametips)}</font></td> 
      </tr> 
      <tr> 
        <td align="right">{lang(ordertel)}：</td> 
        <td align="left"><input type="text" size="10" name="telphone" /> 
          <font color="green">{lang(pcontactteltips)}</font></td> 
      </tr> 
      <tr> 
        <td align="right">{lang(orderaddress)}：</td> 
        <td align="left"><input type="text" size="50" name="address"/></td> 
      </tr> 
      <tr> 
        <td align="right">{lang(postcode)}：</td> 
        <td align="left"><input type="text" size="10" name="postcode"/></td> 
      </tr> 
      
      {if $logisticslist}
      <tr> 
        <td align="right">{lang(pickingmethods)}：</td> 
        <td align="left">
        {loop $logisticslist $logistics}
        <div style="border:1px solid #CCC">
        <input name="logisticsid" type="radio" value="{$logistics[id]}" checked="checked" /><strong>{$logistics[title]}</strong> {lang(fees)}：{$logistics[price]}<br />
        {$logistics[content]}
        </div>
        {/loop}
        </td> 
      </tr>
      {/if} 
      
     
      <tr> 
        <td align="right">{lang(payment)}：</td>
        
        <td align="left">
        {if $paylist}
        {loop $paylist $pay}
        {if $pay[enabled]==1} 
        <div>
        <input name="payname" type="radio" value="{$pay[pay_code]}" checked="checked" /><strong>{$pay[pay_name]}</strong> {lang(rates)}：{$pay[pay_fee]}%<br />
        <!-- {$pay[pay_desc]} -->
        </div>       
        {/if}
        {/loop}
        
        {else}
        {lang(nopayment)}   
        {/if}     
        </td> 
        
      </tr> 
      
      
      <tr> 
        <td align="right">{lang(ordercontent)}：</td> 
        <td align="left" valign="top"><textarea name="content" cols="41" rows="7"></textarea> 
         </td> 
      </tr> 
 
      <tr> 
        <td align="right"> </td> 
        <td align="left"><input type="submit" name="submit" value=" {lang(submit)} " /> 
        <input type="reset" value=" {lang(reset)} " /> 
          </td> 
      </tr> 
    </table> 
</form>

<div class="blank30"></div>
<div class="clear"></div>
</div>



<div class="clear"></div>
</div>
<!-- 中部结束 -->


<div class="c_bottom"></div>
<div class="clear"></div>
</div>
<div class="blank10"></div>
<div class="f" style="color:#ccc;text-align:center;">
{get(site_right)} <a title="{get('sitename')}" href="{$base_url}/">{get('sitename')}</a> All Rights Reserved.      Powered by <a href="http://www.cmseasy.cn" title="CmsEasy企业网站系统" target="_blank">CmsEasy</a>
</div>

</body>
</html>